﻿using System.Runtime.InteropServices;

namespace TcpClient
{
    internal class Program
    {

        //TCP客户端测试
        static void TcpClientTest()
        {
            var client = new System.Net.Sockets.TcpClient();
            client.Connect("10.0.0.2",12345);
            using (var stream = client.GetStream())
            {
                using (var writer = new System.IO.StreamWriter(stream))
                {
                    writer.WriteLine("Hello, World!");
                    writer.Flush();
                }
            }
            client.Close();

        }

        [DllImport("*")]
        internal static extern void SetIcsNativeaotActiveCode(byte[] activeCode);
        static void Main(string[] args)
        {
            var activeCode = new byte[] { 0x3B, 0xD9, 0xDD, 0xF5, 0x00, 0xCE, 0x42, 0x8D, 0x5D, 0xAA, 0xEA, 0x90, 0x81, 0xB8, 0xEE, 0x80, 0xAB, 0xCD, 0x78, 0x71, 0xA3, 0xB1, 0x97, 0x4F, 0x9C, 0x01, 0xCE, 0xE2, 0x58, 0x0A, 0x84, 0xB1, };
            //获取当前platform
            var platform = RuntimeInformation.ProcessArchitecture;
            if (platform == Architecture.Arm)
            {
                SetIcsNativeaotActiveCode(activeCode);
            }
            TcpClientTest();

            Console.WriteLine("Test Complete!");
        }
    }
}
